-- LongPress
-- create by zouyb
-- 长按相关处理函数

-- 处理长按
-- @return 返回true，表示长按已触发，调用者需要直接返回
function handleLongPress(sender, eventType, callback, cancelCallback)
	if eventType == ccui.TouchEventType.began then
		sender.isLongPress = false;
		performWithDelay(sender, function() 
			sender.isLongPress = true;	
			if callback then callback(); end
			end, LONG_PRESS_TIME);
	elseif eventType == ccui.TouchEventType.canceled
		or eventType == ccui.TouchEventType.ended then
		if false == sender.isLongPress then
			sender:stopAllActions();
			if cancelCallback then cancelCallback(); end
		else
			-- 长按触发了
			return true;
		end
	end

	return false;
end
